//
//  MineGifCell.m
//  GiftNote
//
//  Created by lanou on 15/8/21.
//  Copyright (c) 2015年 GN. All rights reserved.
//

#import "MineGifCell.h"
#import "HomeHeader.h"
#import "UIImageView+WebCache.h"

@implementation MineGifCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _myImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, 144, 60)];
        [self.contentView addSubview:_myImageView];
        
        _desLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_myImageView.frame) + 5, 5, kHomeWidth - CGRectGetMaxX(_myImageView.frame) - 5, 40)];
        _desLabel.font = [UIFont systemFontOfSize:14];
        _desLabel.numberOfLines = 0;
        [self.contentView addSubview:_desLabel];
        
        _priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(kHomeWidth - 35, CGRectGetMaxY(_desLabel.frame) + 10, 30, 10)];
        _priceLabel.font = [UIFont systemFontOfSize:10];
        _priceLabel.textColor = [UIColor redColor];
        [self.contentView addSubview:_priceLabel];
        
    }
    return self;
}

- (void)setBuyModel:(HomeBuyDetailModel *)buyModel
{
    _buyModel = buyModel;
    [_myImageView sd_setImageWithURL:[NSURL URLWithString:[_buyModel.image_urls firstObject]] placeholderImage:nil];
    _desLabel.text = _buyModel.desp;
    _priceLabel.text = [NSString stringWithFormat:@"￥ %ld",(long)[_buyModel.price intValue]];
}

@end
